<template>
  <div>
    <el-row :gutter="20">
      <div class="my-body">
        <el-divider content-position="left">历史任务</el-divider>
          <el-table :data="tableData" border ref="multipleTable">
            <el-table-column label="流程名称" prop="processDefinitionName"/>
            <el-table-column label="开始时间" prop="startTime">
              <template slot-scope="scope">
                {{momentF(scope.row.startTime)}}
              </template>
            </el-table-column>
            <el-table-column label="完成时间" prop="endTime">
              <template slot-scope="scope">
                {{momentF(scope.row.endTime)}}
              </template>
            </el-table-column>
            <el-table-column label="版本号" prop="processDefinitionVersion"/>
            <el-table-column label="修订版" prop="revision"/>
            <el-table-column label="发起人" prop="startUserId"/>
<!--            <el-table-column label="原始持久状态持续时间" prop="originalPersistentState.durationInMillis">-->
<!--              <template slot-scope="scope">-->
<!--                {{ parseInt(scope.row.originalPersistentState.durationInMillis * 0.000001) }} 分钟-->
<!--              </template>-->
<!--            </el-table-column>-->
            <el-table-column label="持久状态持续时间" prop="persistentState.durationInMillis">
              <template slot-scope="scope">
                {{ momentSecondToF(scope.row.originalPersistentState.durationInMillis) }}
              </template>
            </el-table-column>
            <el-table-column label="操作" width="250">
              <template slot-scope="scope">
                <el-link type="primary" :loading="loading" :underline="false" @click="showF(scope.row)">编辑</el-link>
              </template>
            </el-table-column>
          </el-table>
          <el-pagination background layout="prev, pager, next" style="margin-top: 10px"
                         :page-size="page.pageSize"
                         :total="page.total"
                         :current-page="page.currentPage"
                         @current-change="currentChange">
          </el-pagination>
      </div>
    </el-row>
  </div>
</template>

<script>
import table from "@/mixins/table";
import service from "@/api/service";

export default {
  name: "processInstanceHistory",
  mixins: [table],
  data() {
    return {
      activeNames: 0,

    }
  },
  methods: {
    init() {
      let form = {
        ...this.searchForm,
        page: this.page.currentPage - 1,
        size: 10,
      }
      service.get('/small-service-flowable/history', form).then(res => {
        if (res.status === 200) {
          this.tableData = res.data;
          this.page.total = res.total;
        }
      })
    },
    showF(row) {
      service.get('/small-service-flowable/history/detail/list', {
        processInstanceId: row.processInstanceId
      }).then(res => {
        if (res.status === 200) {

        }
      })
    },

  }
}
</script>

<style scoped>

</style>